package com.example.flow.dao.model;

import com.example.flow.flow.model.FlowNodes;
import com.example.flow.flow.model.ProcessModel;
import com.example.flow.flow.model.vo.SaveFlowProcessReq;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Table;
import java.io.Serializable;

/**
 * 流程定义
 *
 * @author tangaq
 * 2023/6/13
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Table(name = "flow_process")
public class FlowProcess extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 7786229012994059488L;
    /**
     * 流程定义id
     */
    private String processId;

    /**
     * 流程定义名称
     */
    private String processName;

    /**
     * 描述
     */
    private String description;

    /**
     * 流程类型EnumFlowProcessType
     */
    private String processType;

    /**
     * 是否可用
     */
    private Integer state;

    /**
     * 版本
     */
    private Integer version;

    /**
     * 最大申请有效期
     */
    private Integer maxValidDay;
    /**
     * 创建者
     */
    private String creator;
    /**
     * 修改人
     */
    private String modifier;

    private ProcessModel model;

    private FlowNodes flowNodes;

    private Long uts;

    public FlowProcess() {
    }

    public FlowProcess(SaveFlowProcessReq req) {
        this.processName = req.getProcessName();
        this.description = req.getDescription();
        this.processType = req.getProcessType();
        this.maxValidDay = req.getMaxValidDay();
    }
}
